/**
 * 
 */
package sqs.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @author kjleng
 *
 */
public class MultipleAnsMCQQuestion extends MCQQuestion {
	private List<MultipleAnsMCQQuestionAnswer> multipleAnsMCQQuestionAnswers = new ArrayList<MultipleAnsMCQQuestionAnswer>();
	private List<Option> options = new ArrayList<Option>();
        
        // Added by Joko 18/01/2008
	private String reportOrder = MCQQuestion.SORTBY_ORDERNO;
                
	public void addAnswer(Answer ans){
		multipleAnsMCQQuestionAnswers.add((MultipleAnsMCQQuestionAnswer)ans);
		answered = true;
	}
	
	public List<MultipleAnsMCQQuestionAnswer> getMultipleAnsMCQQuestionAnswers() {
		return multipleAnsMCQQuestionAnswers;
	}

	public void setMultipleAnsMCQQuestionAnswers(
			List<MultipleAnsMCQQuestionAnswer> multipleAnsMCQQuestionAnswers) {
		this.multipleAnsMCQQuestionAnswers = multipleAnsMCQQuestionAnswers;
	}

	public Answer createAnswer(){
		return new MultipleAnsMCQQuestionAnswer();
	}
	
	public List<Option> getOptions(){
		return options;
	}
	public void setOptions(List<Option> options) {
		this.options = options;
	}

	public int getNumOfRespondents(){
		return multipleAnsMCQQuestionAnswers.size();
	}
        
	public List getAnswers(){
		return multipleAnsMCQQuestionAnswers;
	}

        // Added by Joko 18/01/2008
        public String getReportOrder() {
                return reportOrder;
        }
        
        // Added by Joko 18/01/2008
        public void setReportOrder(String reportOrder) {
                this.reportOrder = reportOrder;
        }
        
        // Added by Joko 18/01/2008
        public Option getOptionById(int optionId) {
                for(Option o : options) {
                        if(o.getOptionId()==optionId)
                                return o;
                }
                return null;
        }
}
